prefix = /usr/local
exec_prefix = ${prefix}
libdir = -L${exec_prefix}/lib -L/usr/local/ssl/lib64
lib = -lpbc -lgmp -lm -lssl -lcrypto -lpthread -lrt -ldl
includedir = -I${prefix}/include -I/usr/local/ssl/include/


CC = g++
CFLAGS = -O3 -Wall -ftree-vectorize -fopenmp -msse2 $(includedir)
LDFLAGS = -O3 -Wall $(libdir) -static
LDFLAGSST = -O3 -Wall -ftree-vectorize -fopenmp -msse2 -L$(libdir) -static
DISTNAME = setint
SOURCES =   client.o test_client.o server.o test_server.o basic_tool.o \
			config.o memreuse.o randomnumber.o crypto_tool.o mpz_tool.o \
			fnp_psi_client.o fnp_psi_server.o \
			rsa_apsi_opt_client.o rsa_apsi_opt_server.o \
			rsa_psi_opt_client.o rsa_psi_opt_server.o \
			brsa_psi_client.o brsa_psi_server.o \
			jl10_psi_client.o jl10_psi_server.o \
			ibe_apsi_client.o ibe_apsi_server.o \
			bcckls_psi_client.o bcckls_psi_server.o


.Phony: clean

all: SetInt SetIntAdapt

RSAkeygen: rsakeygen.o rsakeygen_main.o $(SOURCES)
	$(CC) -o $@ $(LDFLAGS) $(includedir) $^ $(lib)

DSAkeygen: dsakeygen.o $(SOURCES)
	$(CC) -o $@ $(LDFLAGS) $(includedir) $^ $(lib)

IBEkeygen: ibe_keygen.o $(SOURCES)
	$(CC) -o $@ $(LDFLAGS) $(includedir) $^ $(lib)

GenCyclic: $(SOURCES) gen_cyclic.o
	$(CC) -o $@ $(LDFLAGS) $(includedir) $^ $(lib)

SetInt: $(SOURCES) main.o
	$(CC) -o $@ $(LDFLAGS) $(includedir) $^ $(lib)

SetIntAdapt: $(SOURCES) main_adaptive.o
	$(CC) -o $@ $(LDFLAGS) $(includedir) $^ $(lib)

%.o: %.cc
	$(CC) -c -o $@ $< $(CFLAGS)

clean:
	rm -rf *.o *.a $(DISTNAME) *.tar.gz TAGS *~

